<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>allocator_access</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Chapter 1. Boost.Core">
<link rel="up" href="../index.html" title="Chapter 1. Boost.Core">
<link rel="prev" href="addressof.html" title="addressof">
<link rel="next" href="allocator_traits.html" title="allocator_traits">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="addressof.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="allocator_traits.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="core.allocator_access"></a><a class="link" href="allocator_access.html" title="allocator_access">allocator_access</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="allocator_access.html#core.allocator_access.overview">Overview</a></span></dt>
<dt><span class="section"><a href="allocator_access.html#core.allocator_access.examples">Examples</a></span></dt>
<dt><span class="section"><a href="allocator_access.html#core.allocator_access.reference">Reference</a></span></dt>
<dt><span class="section"><a href="allocator_access.html#core.allocator_access.acknowledgments">Acknowledgments</a></span></dt>
</dl></div>
<div class="simplesect">
<div class="titlepage"><div><div><h3 class="title">
<a name="idm539"></a>Authors</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
          Glen Fernandes
        </li></ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="core.allocator_access.overview"></a><a class="link" href="allocator_access.html#core.allocator_access.overview" title="Overview">Overview</a>
</h3></div></div></div>
<p>
        The header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">core</span><span class="special">/</span><span class="identifier">allocator_access</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
        provides the class and function templates to simplify allocator use. It provides
        the same functionality as the C++ standard library <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator_traits</span></code>
        but with individual templates for each allocator feature.
      </p>
<p>
        These facilities also simplify existing libraries by avoiding having to check
        for <code class="computeroutput"><span class="identifier">BOOST_NO_CXX11_ALLOCATOR</span></code>
        and conditionally use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator_traits</span></code>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="core.allocator_access.examples"></a><a class="link" href="allocator_access.html#core.allocator_access.examples" title="Examples">Examples</a>
</h3></div></div></div>
<p>
        The following example shows these utilities used in the definition of an
        allocator-aware container class:
      </p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">default_allocator</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">container</span>
    <span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">empty_value</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_rebind</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
    <span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">value_type</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="identifier">A</span> <span class="identifier">allocator_type</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_size_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">size_type</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_difference_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">difference_type</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="identifier">value_type</span><span class="special">&amp;</span> <span class="identifier">reference</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&amp;</span> <span class="identifier">const_reference</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">pointer</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_const_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">const_pointer</span><span class="special">;</span>
    <span class="comment">// ...</span>
<span class="special">};</span>
</pre>
<p>
        In C++11 or above, aliases such as <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span></code>
        can be used instead of <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">allocator_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="core.allocator_access.reference"></a><a class="link" href="allocator_access.html#core.allocator_access.reference" title="Reference">Reference</a>
</h3></div></div></div>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_value_type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_value_type_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">allocator_value_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_pointer</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_pointer_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">allocator_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_const_pointer</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_const_pointer_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">allocator_const_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_void_pointer</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_void_pointer_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">allocator_void_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_const_void_pointer</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_const_void_pointer_t</span> <span class="special">=</span>
    <span class="keyword">typename</span> <span class="identifier">allocator_const_void_pointer</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_difference_type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_difference_type_t</span> <span class="special">=</span>
    <span class="keyword">typename</span> <span class="identifier">allocator_difference_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_size_type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_size_type_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">allocator_size_type</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_propagate_on_container_copy_assignment</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_propagate_on_container_copy_assignment_t</span> <span class="special">=</span>
    <span class="keyword">typename</span> <span class="identifier">allocator_propagate_on_container_copy_assignment</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_propagate_on_container_move_assignment</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_propagate_on_container_move_assignment_t</span> <span class="special">=</span>
    <span class="keyword">typename</span> <span class="identifier">allocator_propagate_on_container_move_assignment</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_propagate_on_container_swap</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_propagate_on_container_swap_t</span> <span class="special">=</span>
    <span class="keyword">typename</span> <span class="identifier">allocator_propagate_on_container_swap</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_is_always_equal</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_is_always_equal_t</span> <span class="special">=</span>
    <span class="keyword">typename</span> <span class="identifier">allocator_is_always_equal</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">allocator_rebind</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">allocator_rebind_t</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">allocator_rebind</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_allocate</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">n</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_allocate</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">n</span><span class="special">,</span>
    <span class="identifier">allocator_const_void_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">h</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="keyword">void</span> <span class="identifier">allocator_deallocate</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">p</span><span class="special">,</span>
    <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">n</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">&gt;</span>
<span class="keyword">void</span> <span class="identifier">allocator_construct</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">Args</span><span class="special">&amp;&amp;...</span> <span class="identifier">args</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">void</span> <span class="identifier">allocator_destroy</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T</span><span class="special">*</span> <span class="identifier">p</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_max_size</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span>
<span class="identifier">A</span> <span class="identifier">allocator_select_on_container_copy_construction</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">);</span>

<span class="special">}</span> <span class="comment">// boost</span>
</pre>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="core.allocator_access.reference.types"></a><a class="link" href="allocator_access.html#core.allocator_access.reference.types" title="Types">Types</a>
</h4></div></div></div>
<div class="variablelist">
<p class="title"><b></b></p>
<dl class="variablelist">
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_value_type</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">value_type</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_pointer</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">pointer</span></code> if valid, otherwise <code class="computeroutput"><span class="identifier">allocator_value_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;*</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_const_pointer</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">const_pointer</span></code> if valid, otherwise
                <code class="computeroutput"><span class="identifier">pointer_traits</span><span class="special">&lt;</span><span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span>
                <span class="special">&gt;::</span><span class="identifier">rebind</span><span class="special">&lt;</span><span class="keyword">const</span>
                <span class="identifier">allocator_value_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="special">&gt;</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_void_pointer</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">void_pointer</span></code> if valid, otherwise
                <code class="computeroutput"><span class="identifier">pointer_traits</span><span class="special">&lt;</span><span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span>
                <span class="special">&gt;::</span><span class="identifier">rebind</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_const_void_pointer</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">const_void_pointer</span></code> if valid, otherwise
                <code class="computeroutput"><span class="identifier">pointer_traits</span><span class="special">&lt;</span><span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span>
                <span class="special">&gt;::</span><span class="identifier">rebind</span><span class="special">&lt;</span><span class="keyword">const</span>
                <span class="keyword">void</span><span class="special">&gt;</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_difference_type</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">difference_type</span></code> if valid, otherwise
                <code class="computeroutput"><span class="identifier">pointer_traits</span><span class="special">&lt;</span><span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span>
                <span class="special">&gt;::</span><span class="identifier">difference_type</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_size_type</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">size_type</span></code> if valid, otherwise
                <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">make_unsigned_t</span><span class="special">&lt;</span><span class="identifier">allocator_difference_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span>
                <span class="special">&gt;</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_propagate_on_container_copy_assignment</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">propagate_on_container_copy_assignment</span></code>
                if valid, otherwise <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">false_type</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_propagate_on_container_move_assignment</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">propagate_on_container_move_assignment</span></code>
                if valid, otherwise <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">false_type</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_propagate_on_container_swap</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">propagate_on_container_swap</span></code> if
                valid, otherwise <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">false_type</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">struct</span>
            <span class="identifier">allocator_is_always_equal</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">is_always_equal</span></code> if valid, otherwise
                <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">is_empty</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">allocator_rebind</span><span class="special">;</span></code></span></dt>
<dd><p>
                The member <code class="computeroutput"><span class="identifier">type</span></code> is
                <code class="computeroutput"><span class="identifier">A</span><span class="special">::</span><span class="identifier">rebind</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">other</span></code> if valid, otherwise <code class="computeroutput"><span class="identifier">A</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Args</span><span class="special">&gt;</span></code>
                if this <code class="computeroutput"><span class="identifier">A</span></code> is <code class="computeroutput"><span class="identifier">A</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">,</span> <span class="identifier">Args</span><span class="special">&gt;</span></code>.
              </p></dd>
</dl>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="core.allocator_access.reference.functions"></a><a class="link" href="allocator_access.html#core.allocator_access.reference.functions" title="Functions">Functions</a>
</h4></div></div></div>
<div class="variablelist">
<p class="title"><b></b></p>
<dl class="variablelist">
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_allocate</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">n</span><span class="special">);</span></code></span></dt>
<dd><p>
                Calls <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">allocate</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_allocate</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">allocator_const_void_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">hint</span><span class="special">);</span></code></span></dt>
<dd><p>
                Calls <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">allocate</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">hint</span><span class="special">)</span></code>
                if valid, otherwise calls <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">allocate</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">allocator_deallocate</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">allocator_pointer_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">n</span><span class="special">);</span></code></span></dt>
<dd><p>
                Calls <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">deallocate</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">n</span><span class="special">)</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">&gt;</span>
            <span class="keyword">void</span> <span class="identifier">allocator_construct</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T</span><span class="special">*</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">Args</span><span class="special">&amp;&amp;...</span> <span class="identifier">args</span><span class="special">);</span></code></span></dt>
<dd><p>
                Calls <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">construct</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">Args</span><span class="special">&gt;(</span><span class="identifier">args</span><span class="special">)...)</span></code>
                if valid, otherwise calls <code class="computeroutput"><span class="special">::</span><span class="keyword">new</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">*&gt;(</span><span class="identifier">p</span><span class="special">))</span> <span class="identifier">T</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">Args</span><span class="special">&gt;(</span><span class="identifier">args</span><span class="special">)...)</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">allocator_destroy</span><span class="special">(</span><span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T</span><span class="special">*</span> <span class="identifier">p</span><span class="special">);</span></code></span></dt>
<dd><p>
                Calls <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">p</span><span class="special">)</span></code>
                if valid, otherwise calls <code class="computeroutput"><span class="identifier">p</span><span class="special">-&gt;~</span><span class="identifier">T</span><span class="special">()</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">allocator_max_size</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">);</span></code></span></dt>
<dd><p>
                Returns <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">()</span></code>
                if valid, otherwise returns <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">allocator_size_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">max</span><span class="special">()</span>
                <span class="special">/</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">allocator_value_type_t</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">&gt;)</span></code>.
              </p></dd>
<dt><span class="term"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">&gt;</span> <span class="identifier">A</span> <span class="identifier">allocator_select_on_container_copy_construction</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">);</span></code></span></dt>
<dd><p>
                Returns <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">select_on_container_copy_construction</span><span class="special">()</span></code> if valid, otherwise returns <code class="computeroutput"><span class="identifier">a</span></code>.
              </p></dd>
</dl>
</div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="core.allocator_access.acknowledgments"></a><a class="link" href="allocator_access.html#core.allocator_access.acknowledgments" title="Acknowledgments">Acknowledgments</a>
</h3></div></div></div>
<p>
        Glen Fernandes implemented the allocator access utilities.
      </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2014 Peter Dimov<br>Copyright © 2014 Glen Fernandes<br>Copyright © 2014 Andrey Semashev<p>
        Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost
        Software License, Version 1.0</a>.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="addressof.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="allocator_traits.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
